//
//  XMSignCollectionViewCell.m
//  XunMi
//
//  Created by MacBook on 2024/4/15.
//  Copyright © 2024 TieZhu. All rights reserved.
//

#import "XMSignCollectionViewCell.h"
#import "XMSignModel.h"

@interface XMSignCollectionViewCell ()
@property (weak, nonatomic) IBOutlet UIButton *bgButton;
@property (weak, nonatomic) IBOutlet UIButton *dayButton;
@property (weak, nonatomic) IBOutlet UIImageView *goldImgV;
@property (weak, nonatomic) IBOutlet UILabel *countLa;
@property (weak, nonatomic) IBOutlet UIImageView *colorImgV;
@property (weak, nonatomic) IBOutlet UILabel *freeCountLa;

@end

@implementation XMSignCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setModel:(XMSignItemModel *)model {
    _model = model;
    self.bgButton.selected = model.status;
    self.dayButton.selected = model.status;
    [self.dayButton setTitle:kValueToString(model.days) forState:UIControlStateNormal];
    
    self.countLa.text = kStringFormat(@"+%@", model.reward_num);
    self.freeCountLa.text = kStringFormat(@"x%@", model.reward_num);
    switch (model.reward_type.intValue) {
            /*
             10001：金币；
             20001：积分；
             30001：红包；
             40001：免费聊天卡；
             40002：音频折扣卡；
             40003：视频折扣卡；
             40004：充值减免卡；
             40005：提现次数卡
             */
        case 10001: 
        case 20001: {
            self.goldImgV.hidden = NO;
            self.countLa.hidden = NO;
            self.colorImgV.hidden = YES;
            self.freeCountLa.hidden = YES;
        } break;
            
        case 40001: {
            self.goldImgV.hidden = YES;
            self.countLa.hidden = YES;
            self.colorImgV.hidden = NO;
            self.freeCountLa.hidden = NO;
            self.colorImgV.image = kGetImage(kStringFormat(@"sign_%@", model.reward_type));
        } break;
            
        case 40002:
        case 40003:
        case 40004:
        case 40005: {
            self.goldImgV.hidden = YES;
            self.countLa.hidden = YES;
            self.colorImgV.hidden = NO;
            self.freeCountLa.hidden = YES;
            self.colorImgV.image = kGetImage(kStringFormat(@"sign_%@", model.reward_type));
        } break;
            
        default:
            self.goldImgV.hidden = YES;
            self.countLa.hidden = YES;
            self.colorImgV.hidden = YES;
            self.freeCountLa.hidden = YES;
            break;
    }
}

@end
